EmSAT Achieve Exam  >  EmSAT Achieve Questions  >  interface Base{ boolean m1 (); byte m2(shor... Start Learning for Free
interface Base 
{
    boolean m1 ();
    byte m2(short s);
}
which two code fragments will compile?
1. interface Base2 implements Base {}
2. abstract class Class2 extends Base
{ public boolean m1(){ return true; }}
3. abstract class Class2 implements Base {}
4. abstract class Class2 implements Base
{ public boolean m1(){ return (7 > 4); }}
5. abstract class Class2 implements Base
{ protected boolean m1(){ return (5 > 7) }}
  • a)
    1 and 2
  • b)
    2 and 3
  • c)
    3 and 4
  • d)
    1 and 5
Correct answer is option 'C'. Can you explain this answer?
Most Upvoted Answer
interface Base{ boolean m1 (); byte m2(short s);}which two code frag...
(3) is correct because an abstract class doesn't have to implement any or all of its interface's methods. (4) is correct because the method is correctly implemented ((7 > 4) is a boolean).
(1) is incorrect because interfaces don't implement anything. (2) is incorrect because classes don't extend interfaces. (5) is incorrect because interface methods are implicitly public, so the methods being implemented must be public.
Explore Courses for EmSAT Achieve exam

Top Courses for EmSAT Achieve

Question Description
interface Base{ boolean m1 (); byte m2(short s);}which two code fragments will compile?1. interface Base2 implements Base {}2. abstract class Class2 extends Base{ public boolean m1(){ return true; }}3. abstract class Class2 implements Base {}4. abstract class Class2 implements Base{ public boolean m1(){ return (7 > 4); }}5. abstract class Class2 implements Base{ protected boolean m1(){ return (5 > 7) }}a)1 and 2b)2 and 3c)3 and 4d)1 and 5Correct answer is option 'C'. Can you explain this answer? for EmSAT Achieve 2025 is part of EmSAT Achieve preparation. The Question and answers have been prepared according to the EmSAT Achieve exam syllabus. Information about interface Base{ boolean m1 (); byte m2(short s);}which two code fragments will compile?1. interface Base2 implements Base {}2. abstract class Class2 extends Base{ public boolean m1(){ return true; }}3. abstract class Class2 implements Base {}4. abstract class Class2 implements Base{ public boolean m1(){ return (7 > 4); }}5. abstract class Class2 implements Base{ protected boolean m1(){ return (5 > 7) }}a)1 and 2b)2 and 3c)3 and 4d)1 and 5Correct answer is option 'C'. Can you explain this answer? covers all topics & solutions for EmSAT Achieve 2025 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for interface Base{ boolean m1 (); byte m2(short s);}which two code fragments will compile?1. interface Base2 implements Base {}2. abstract class Class2 extends Base{ public boolean m1(){ return true; }}3. abstract class Class2 implements Base {}4. abstract class Class2 implements Base{ public boolean m1(){ return (7 > 4); }}5. abstract class Class2 implements Base{ protected boolean m1(){ return (5 > 7) }}a)1 and 2b)2 and 3c)3 and 4d)1 and 5Correct answer is option 'C'. Can you explain this answer?.
Solutions for interface Base{ boolean m1 (); byte m2(short s);}which two code fragments will compile?1. interface Base2 implements Base {}2. abstract class Class2 extends Base{ public boolean m1(){ return true; }}3. abstract class Class2 implements Base {}4. abstract class Class2 implements Base{ public boolean m1(){ return (7 > 4); }}5. abstract class Class2 implements Base{ protected boolean m1(){ return (5 > 7) }}a)1 and 2b)2 and 3c)3 and 4d)1 and 5Correct answer is option 'C'. Can you explain this answer? in English & in Hindi are available as part of our courses for EmSAT Achieve. Download more important topics, notes, lectures and mock test series for EmSAT Achieve Exam by signing up for free.
Here you can find the meaning of interface Base{ boolean m1 (); byte m2(short s);}which two code fragments will compile?1. interface Base2 implements Base {}2. abstract class Class2 extends Base{ public boolean m1(){ return true; }}3. abstract class Class2 implements Base {}4. abstract class Class2 implements Base{ public boolean m1(){ return (7 > 4); }}5. abstract class Class2 implements Base{ protected boolean m1(){ return (5 > 7) }}a)1 and 2b)2 and 3c)3 and 4d)1 and 5Correct answer is option 'C'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of interface Base{ boolean m1 (); byte m2(short s);}which two code fragments will compile?1. interface Base2 implements Base {}2. abstract class Class2 extends Base{ public boolean m1(){ return true; }}3. abstract class Class2 implements Base {}4. abstract class Class2 implements Base{ public boolean m1(){ return (7 > 4); }}5. abstract class Class2 implements Base{ protected boolean m1(){ return (5 > 7) }}a)1 and 2b)2 and 3c)3 and 4d)1 and 5Correct answer is option 'C'. Can you explain this answer?, a detailed solution for interface Base{ boolean m1 (); byte m2(short s);}which two code fragments will compile?1. interface Base2 implements Base {}2. abstract class Class2 extends Base{ public boolean m1(){ return true; }}3. abstract class Class2 implements Base {}4. abstract class Class2 implements Base{ public boolean m1(){ return (7 > 4); }}5. abstract class Class2 implements Base{ protected boolean m1(){ return (5 > 7) }}a)1 and 2b)2 and 3c)3 and 4d)1 and 5Correct answer is option 'C'. Can you explain this answer? has been provided alongside types of interface Base{ boolean m1 (); byte m2(short s);}which two code fragments will compile?1. interface Base2 implements Base {}2. abstract class Class2 extends Base{ public boolean m1(){ return true; }}3. abstract class Class2 implements Base {}4. abstract class Class2 implements Base{ public boolean m1(){ return (7 > 4); }}5. abstract class Class2 implements Base{ protected boolean m1(){ return (5 > 7) }}a)1 and 2b)2 and 3c)3 and 4d)1 and 5Correct answer is option 'C'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice interface Base{ boolean m1 (); byte m2(short s);}which two code fragments will compile?1. interface Base2 implements Base {}2. abstract class Class2 extends Base{ public boolean m1(){ return true; }}3. abstract class Class2 implements Base {}4. abstract class Class2 implements Base{ public boolean m1(){ return (7 > 4); }}5. abstract class Class2 implements Base{ protected boolean m1(){ return (5 > 7) }}a)1 and 2b)2 and 3c)3 and 4d)1 and 5Correct answer is option 'C'. Can you explain this answer? tests, examples and also practice EmSAT Achieve tests.
Explore Courses for EmSAT Achieve exam

Top Courses for EmSAT Achieve

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev